-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[commonmark] make code fences compliant (+ fix 1058) #1387
Conversation
…still allowing empty code blocks
…and info string compliant to commonmark
…locks (pass cm example 112)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome! I made a suggestion to change the infostring
to language
but I see now that the spec actually refers to it as info string so I'm okay with either name.
@styfle exactly, I changed the wording to better adhere to commonmark, see the paragraph and the examples below example 110. The language is the first word of the info string, which may contain other information. |
Fix list updated. |
@@ -91,7 +91,7 @@ block.normal = merge({}, block); | |||
*/ | |||
|
|||
block.gfm = merge({}, block.normal, { | |||
fences: /^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\n? *\1 *(?:\n+|$)/, | |||
fences: /^ {0,3}(`{3,}|~{3,})([^`\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no more vulnerable than it previously was.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This introduces no further vulnerabilities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are getting closer to 100% spec compliance. Keep up the good work. 🎉
Code fences containing a matching fence not on a new line are terminated incorrectly
This gets up to 100% compliance with commonmark fenced code blocks
Test(s) exist to ensure functionality and minimize regression (if no tests added, list tests covering this PR); or,
Draft GitHub release notes have been updated.
CI is green (no forced merge required).
Merge PR